﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OXY
{
    class Triangle
    {
        private Point A;
        private Point B;
        private Point C;

        public Triangle()
        {
            A = new Point();
            B = new Point();
            C = new Point();
        }

        public Triangle(Point A, Point B, Point C)
        {
            this.A = new Point(A);
            this.B = new Point(B);
            this.C = new Point(C);
        }

        public Point DinhA
        {
            get { return A; }
            set { A = value; }
        }

        public Point DinhB
        {
            get { return B; }
            set { B = value; }
        }

        public Point DinhC
        {
            get { return C; }
            set { C = value; }
        }

        public double perimeter()
        {
            double side1 = A.distance(B);
            double side2 = B.distance(C);
            double side3 = C.distance(A);
            double res = side1 + side2 + side3;
            return res;
        }

        public double square()
        {
            double side1 = A.distance(B);
            double side2 = B.distance(C);
            double side3 = C.distance(A);
            double p = (side1 + side2 + side3) / 2;
            double res = Math.Sqrt(p*(p-side1)*(p-side2)*(p-side3));
            return res;
        }

        public Point center()
        {
            Point temp = new Point();
            temp.HoanhDo = ((A.HoanhDo + B.HoanhDo + C.HoanhDo) / 3);
            temp.TungDo = ((A.TungDo + B.TungDo + C.TungDo) / 3);
            return temp;
        }
    }
}
